package com.itheima.common;

/**
 * 基于ThreadLocal封装工具类，
 * 用户保存和获取当前登录用户id
 */
public class BaseContext {
    public static final ThreadLocal<Long> threadLocal =new ThreadLocal<>();

    /**
     * 设置值
     * @param id
     */
    public static void set(Long id){
          threadLocal.set(id);
    }

    /**
     * 获取线程里面的值
     * @return
     */

    public static Long get(){
        return threadLocal.get();
    }
}
